#ifndef __LAVALAMP_PARSER_H__
#define __LAVALAMP_PARSER_H__

#include <stdio.h>
#include "../xmlparser/xmlscan.h"
#include "../xmlparser/xmlparse.h"

#define LAVA_BUF_SIZE 10240 

#define TR_ELEMENT   "tr"
#define TBODY_ELEMENT   "tbody"

class CLavalampParser : public CXMLParser
{
public:
   CLavalampParser();
   virtual ~CLavalampParser();
   
public:
/*
 * GetNextLavalampInfoLength returns the length of 
 *  not-truncated lavalamp text info. Returns negative value on error or EOF.
 * CopyLavalampInfo copies the txt to buf, truncate the text if buf is too small.
 *
 */
   int32 GetNextLavalampInfoLength();
   int32 CopyLavalampInfo(char* buf, size_t bufsize);
   
protected:
   char m_szTxt[LAVA_BUF_SIZE];
   bool IsTrUnderTboday(LPXmlContent pContent);
   // combine all the CDATA under one element recursively. return negative value on error or EOF.
   int ConcatenateCDataUnder(LPXmlContent pContent);
   void Concatenate(int* pnDstIdx, const char* szSrc);
};


#endif /* __LAVALAMP_PARSER_H__*/
